package com.hnust.dao;

import com.hnust.domain.CourseTarget;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import com.hnust.domain.CourseTarget;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.List;

/**
 * 课程目标的DAO层
 * @author 42
 * @date 2020/10/29
 */
@Mapper
@Repository
public interface CourseTargetDao {
    //42 查找课程目标
    @Select("select cou_tar_id,content,num from course_target where cou_id = #{couId}")
    @ResultType(CourseTarget.class)
    List<CourseTarget> getCourseTarget(String couId);


	/*
	 * @Author Tonited
	 * @Description //TODO 根据num和courseid获取CourseTargetId
	 * @Date 16:10 2020/10/30
	 * @Param [num, couId]
	 * @return java.lang.String
	 **/
	@Select("select cou_tar_id from course_target where num=#{num} and cou_id=#{couId}")
	@ResultType(String.class)
	String getCouTarIdByNumAndCourseId(String num, String couId);

	/**
	 * 根据课程目标id获取课程目标
	 * @param tarId 课程目标id
	 * @return
	 */
	@Select("select * from course_target where cou_tar_id = #{tarId}")
	@ResultType(CourseTarget.class)
	CourseTarget getCourseTargetById(String tarId);
}
